﻿using System;
using System.Collections.Generic;
using System.Data.Entity;
using System.Linq;
using System.Web;

namespace RegistrationManagement.Models
{
    public class DbInitializer : DropCreateDatabaseIfModelChanges<RegistrationEntities>
    {
        protected override void Seed(RegistrationEntities context)
        {
            var company = new Models.Company() { Name = "深圳川大智胜" };
            context.Companies.Add(company);

            var contact = new Models.Contact() { Name = "张三" };
            contact.Company = company;
            context.Contacts.Add(contact);
            
            context.Registrations.Add(new Registration() { HardwardId = "123", IssueDate = DateTime.Now, ContactInfo = contact});
            context.Registrations.Add(new Registration() { HardwardId = "1234", IssueDate = DateTime.Now, ContactInfo = contact});
            context.Registrations.Add(new Registration() { HardwardId = "1235", IssueDate = DateTime.Now, ContactInfo = contact});

            base.Seed(context);
        }
    }
}